﻿using System;
using System.Web.UI.WebControls;
using FranceTriple.Dal;

namespace TeamFranceTriple
{
    public partial class Register : BaseUserControl
    {
        public string UserAddressIp { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["returnurl"] != null)
                RegisterUser.ContinueDestinationPageUrl = Request.QueryString["returnurl"];
        }


        protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            if (!this.Page.IsValid)
            {
                e.Cancel = true;
                return;
            }
        }

        protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            switch (ThisMaster.Requester.Culture)
            {
                case "fr-fr":
                    MailManager.SendActivationEmail(RegisterUser.UserName, Server.MapPath("~/EmailTemplate/WelcomeNewUser.fr.htm"), true);
                    break;
                default:
                    MailManager.SendActivationEmail(RegisterUser.UserName, Server.MapPath("~/EmailTemplate/WelcomeNewUser.en.htm"), true);
                    break;
            }
        }
    }
}
